<?php
/**
* This is a custom class for helloworld kit
* @link http://webappkit.net
* @package example
* @author J.Ducastel <jeremie@ducastel.name>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/

class ExampleKit extends WakKit {

	/**
	 *@var array data to inject into template
	 */
	var $data = array(
		'msg'=>"meeow");

	/**
	 * @var array files to display path => comment
	 */
	var $files=array(
		'index.php'=>'this is the script called by apache.'
		,'webappkit/include-me.php'=>'Include this file to load Webappkit core libraries.'
		,'webappkit/example.wak/wak.ini'=>'This is the config file for the example kit. It sets dependencies, files to load etc.'
		,'webappkit/example.wak/examplekit.class.php4'=>'This is a custom class for the example kit, allowing it to handle http requests.'
		);

	/**
	 * Application kits have to implment this method
	 * handles http requests
	 */
	function run() {
		// setting language
		$lang=isset($_GET['lang'])?$_GET['lang']:'en';
		$this->templates->setCriteria('lang',$lang);
		// getting template
		$tpl=$this->templates->get('home');
		// reading used files
		foreach ($this->files as $path => $comment) {
			$this->data['files'][]=new ExampleFile($path,$comment);
		}
		// print_r($this->data);
		$this->counter=webappkit::timecounter();
		echo $tpl->render($this->data);
	}
}